//
//  UserViewController.m
//  YiXiu
//
//  Created by ZHY on 16/7/13.
//  Copyright © 2016年 zzz. All rights reserved.
//  发帖人用户信息

#import "UserViewController.h"

@interface UserViewController ()<UITableViewDelegate,UITableViewDataSource>

//@property(nonatomic,strong) UILabel * mainLab;
//
//@property(nonatomic,strong) UILabel * mainLab;

@property(nonatomic,strong)UITableView * tableView;


@end

@implementation UserViewController



- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor grayColor];
    

    [self.view addSubview:self.tableView];
}

-(UITableView *)tableView{
    
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
        _tableView.dataSource = self;
        _tableView.delegate = self;
    }
    return _tableView;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    
    return 4;
    
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    return 60;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    NSString * cellIdentifier = @"cellIdentifier";
    
    UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    
    
    cell.userInteractionEnabled = NO;
    
    if (indexPath.row == 0) {
        
       UILabel * mainLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 60, 60)];
         mainLab.text = @"性别";
         [mainLab setFont:[UIFont boldSystemFontOfSize:18]];
         mainLab.textColor = UIColorFromRGB(0xcccccc);
//        mainLabel.backgroundColor  = [UIColor grayColor];
        [cell addSubview:mainLab];
        
        
        UILabel * sexLab = [[UILabel alloc]initWithFrame:CGRectMake(198, 0, 60, 60)];
        sexLab.text = @"男";
         [mainLab setFont:[UIFont boldSystemFontOfSize:18]];
        mainLab.textColor = UIColorFromRGB(0x333333);
        [cell addSubview:sexLab];
    }else if (indexPath.row == 1){
        
        UILabel * mainLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 60, 60)];
        mainLab.text = @"年龄";
        [mainLab setFont:[UIFont boldSystemFontOfSize:18]];
        mainLab.textColor = UIColorFromRGB(0xcccccc);
        //        mainLabel.backgroundColor  = [UIColor grayColor];
        [cell addSubview:mainLab];
        
        
        UILabel * ageLab= [[UILabel alloc]initWithFrame:CGRectMake(198, 0, 60, 60)];
        ageLab.text = @"21岁";
        [mainLab setFont:[UIFont boldSystemFontOfSize:18]];
        mainLab.textColor = UIColorFromRGB(0x333333);
        [cell addSubview:ageLab];
    }else if (indexPath.row == 2){
        
        UILabel * mainLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 198, 60)];
        mainLab.text = @"性取向";
        [mainLab setFont:[UIFont boldSystemFontOfSize:18]];
        mainLab.textColor = UIColorFromRGB(0xcccccc);
        //        mainLabel.backgroundColor  = [UIColor grayColor];
        [cell addSubview:mainLab];
        
        
        UILabel * ageLab= [[UILabel alloc]initWithFrame:CGRectMake(198, 0, 60, 60)];
        ageLab.text = @"保密";
        [mainLab setFont:[UIFont boldSystemFontOfSize:18]];
        mainLab.textColor = UIColorFromRGB(0x333333);
        [cell addSubview:ageLab];
        
        
    }else if(indexPath.row == 3){
        
        
        UILabel * mainLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 198, 60)];
        mainLab.text = @"婚姻状况";
        [mainLab setFont:[UIFont boldSystemFontOfSize:18]];
        mainLab.textColor = UIColorFromRGB(0xcccccc);
        //        mainLabel.backgroundColor  = [UIColor grayColor];
        [cell addSubview:mainLab];
        
        
        UILabel * ageLab= [[UILabel alloc]initWithFrame:CGRectMake(198, 0, 60, 60)];
        ageLab.text = @"未婚";
        [mainLab setFont:[UIFont boldSystemFontOfSize:18]];
        mainLab.textColor = UIColorFromRGB(0x333333);
        [cell addSubview:ageLab];
        
    }
    return cell;
    
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    UIImageView * view = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 212)];
    
    view.backgroundColor = [UIColor yellowColor];
    
    [view setImage:[UIImage imageNamed:@"otherUserBg"]];
    
    
    UIImageView * imageView = [[UIImageView alloc]init];

    imageView.frame = CGRectMake((KScreenWidth-50)/2, (212-50)/2, 50, 50);
    
    
    
    imageView.backgroundColor = [UIColor redColor];
    
//    [imageView setImage:[UIImage imageNamed:@"otherUserBg"]];
    
    UILabel * nikeLab = [[UILabel alloc]initWithFrame:CGRectMake(0, (212-50)/2+20+50, KScreenWidth, 30)];
    
//    nikeLab.backgroundColor = [UIColor greenColor];
    
    nikeLab.text = @"一羞小和尚";
    
    [nikeLab setFont:[UIFont boldSystemFontOfSize:18]];
    
//    nikeLab.constraints =
    nikeLab.textAlignment = UITextAlignmentCenter;
    
    [view addSubview:nikeLab];
    [view addSubview:imageView];
    
    return view;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    
    return 212;
    
}


@end
